<?php
class SocuteTemplateDefaultWriter
implements ISocuteTemplateWriter
{ 
  private $buffer = '';
  public $buffered = false;
  
  public function write($text){
    if(!$this->buffered){
      echo $text;
    }
    else{
      $this->buffer .= $text;
    }
  }
  
  public function getBuffer(){
    return $this->buffer;
  }
  
  public function clearBuffer(){
    $this->buffer = '';
  }
  
  public function flushBuffer(){
    $buffer = $this->getBuffer();
    $this->clearBuffer();
    return $buffer;
  }
}
?>